package machine;

import automaton.State;
import automaton.Transition;

/**
 * @depend - - - automaton.State
 */
public class TransitionWithAction<T> implements Transition<T> {

	private final Transition<T> transition;
	private final Action<T> action;
	
	public TransitionWithAction(Transition<T> t, Action<T> a) {
		this.transition =t;this.action=a;
	}
	
	public T label() {
		return transition.label();
	}

	public State source() {
		return transition.source();
	}

	public State target() {
		return transition.target();
	}
	
	public State cross() {
		action.execute(transition.label());
		return transition.target();
	}

}
